// 管理分类导航的数据
import { defineStore } from 'pinia'
// 导入 axios
import request from '@/utils/request'
// 导入类型
import { TResult , TCate } from '@/types/cate'
let useCateStore = defineStore('cate', {
  state: () => ({
    test: '我是测试数据',
    // 头部分类数据
    cateList: [] as TCate[]
  }),
  actions: {
    // 获取头部分类数据
    async getCateList () {
      let res = await request.get<TResult>('/home/category/head')
      // 保存数据源
      this.cateList = res.data.result
    }
  },
  getters: {}
})
export default useCateStore
